package com.jan.l1;

import org.eclipse.jface.preference.RadioGroupFieldEditor;
import org.eclipse.jface.window.ApplicationWindow;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class RadioButton
    extends ApplicationWindow
{

  public RadioButton(Shell parentShell)
  {
    super(parentShell);
    // TODO Auto-generated constructor stub
  }
  @Override
  protected Control createContents(Composite parent)
  {
    Button[] radios = new Button[3]; 
//    radios[0] = new Button(parent, SWT.RADIO);
//    radios[0].setSelection(true);
//    radios[0].setText("Choice 1");
//    radios[0].setLocation(10,5);
////    radios[0].pack();
//    radios[1] = new Button(parent, SWT.RADIO);
//    radios[1].setText("Choice 2");
//    radios[1].setLocation(10,30);
////    radios[1].pack();
//    radios[2] = new Button(parent, SWT.RADIO);
//    radios[2].setText("Choice 3");
//    radios[2].setLocation(10,55);
    RadioGroupFieldEditor group=new RadioGroupFieldEditor("UserChoice", "Choose an option:", 1, new String[][] {{"Choice1", "ch1"}, {"Choice2", "ch2"}, {"Choice3", "ch3"}}, parent, true);
//    radios[2].pack();
//    for (int i=0; i<radios.length; i++)
//      if (radios[i].getSelected())
//        System.out.println(i);
    return parent;
  }

  /**
   * TODO
   *
   */
  public static void main(String[] args)
  {
    RadioButton lwin=new RadioButton(null);
    lwin.setBlockOnOpen(true);
    lwin.open();
    
    Display.getCurrent().dispose();

  }

}
